Maple 2019 Questions and Posts

These are Posts and Questions associated with the product, Maple 2019

I am optimizing an objective function subject to two constraints. I have obtained the solution, but I am unsure how to determine the conditions for the Lagrange multipliers μ1​ and μ2​. For example, using the KKT conditions, if μ1>0 then the solution is X, and if μ2>0 then the solution is Y. Could you guide me on how to find μ1 and μ2 along with their corresponding conditions?

restart

with(Optimization); with(plots); with(LinearAlgebra)

_local(Pi)

Pi

(1)
 

`π_m` := proc (i1) options operator, arrow; (w-i1)*(1/2+(1/2)*(i1-i2)/tau)*(1-(Pn-Pr)/(1-delta))-C0-(1/2)*Cr*(1/2+(1/2)*(i1-i2)/tau)^2*(1-(Pn-Pr)/(1-delta))^2+Ce*rho0*(1-(Pn-Pr)/(1-delta)) end proc

C1 := (2*rho0-1)*tau+i2 <= i1

(2*rho0-1)*tau+i2 <= i1

(2)

C2 := i1 <= tau+i2

i1 <= tau+i2

(3)

NULL

NULL

``

NULL

# No equality constraints
#
# Inequality constraints must be of the form f[i](i1) <= 0
#
# Thus
#
# (1) For C1
#     so
      f[1] := (i1) -> (2*rho0 - 1)*tau + i2-i1:
      
#
# (2) C2
#     so
      f[2] := (i1) -> i1-(tau + i2):
      
#

# Lagrangian (we want to maximize `&pi;_m` so to minimize -`&pi;_m`

L := -`&pi;_m`(i1) + add(f[i](i1)*mu[i], i=1..2):

dLdi1 := collect(diff(L, i1), [i1]):

KKT_conditions := [
                    seq(mu[i] >= 0, i=1..2),         # Dual feasibility conditions
                    dLdi1 = 0,                       # Stationarity condition
                    seq(``(f[i](i1)) <= 0, i=1..2),  # Primal feasibility conditions
                    add(mu[i]*f[i](i1) = 0, i=1..2)  # Complementary slackness
                  ]:

print~(KKT_conditions);

0 <= mu[1]

 

0 <= mu[2]

 

((1-(Pn-Pr)/(1-delta))/tau+(1/4)*Cr*(1-(Pn-Pr)/(1-delta))^2/tau^2)*i1+(1/2-(1/2)*i2/tau)*(1-(Pn-Pr)/(1-delta))-(1/2)*w*(1-(Pn-Pr)/(1-delta))/tau+(1/2)*Cr*(1/2-(1/2)*i2/tau)*(1-(Pn-Pr)/(1-delta))^2/tau-mu[1]+mu[2] = 0

 

``((2*rho0-1)*tau+i2-i1) <= 0

 

``(i1-tau-i2) <= 0

 

((2*rho0-1)*tau+i2-i1)*mu[1]+(i1-tau-i2)*mu[2] = 0

 

[]

(4)


Analysis of dLdp1

with(LargeExpressions):

DLDi1 := collect(dLdi1, i1, Veil[K]);

(1/4)*K[1]*i1-(1/4)*K[2]

(5)

# Thus dLdi1 = 0 verifies

isolate((5), i1)
 

i1 = K[2]/K[1]

(6)

# Where K1 and K2 are

i := 'i':
KS := [ seq(K[i] = Unveil[K](K[i]), i=1..LastUsed[K] ) ];

[K[1] = (-1+delta+Pn-Pr)*(Cr*Pn-Cr*Pr+Cr*delta+4*delta*tau-Cr-4*tau)/(tau^2*(-1+delta)^2), K[2] = (4*delta^2*tau^2*mu[1]-4*delta^2*tau^2*mu[2]+Cr*Pn^2*i2-Cr*Pn^2*tau-2*Cr*Pn*Pr*i2+2*Cr*Pn*Pr*tau+2*Cr*Pn*delta*i2-2*Cr*Pn*delta*tau+Cr*Pr^2*i2-Cr*Pr^2*tau-2*Cr*Pr*delta*i2+2*Cr*Pr*delta*tau+Cr*delta^2*i2-Cr*delta^2*tau+2*Pn*delta*i2*tau-2*Pn*delta*tau^2+2*Pn*delta*tau*w-2*Pr*delta*i2*tau+2*Pr*delta*tau^2-2*Pr*delta*tau*w+2*delta^2*i2*tau-2*delta^2*tau^2+2*delta^2*tau*w-8*delta*tau^2*mu[1]+8*delta*tau^2*mu[2]-2*Cr*Pn*i2+2*Cr*Pn*tau+2*Cr*Pr*i2-2*Cr*Pr*tau-2*Cr*delta*i2+2*Cr*delta*tau-2*Pn*i2*tau+2*Pn*tau^2-2*Pn*tau*w+2*Pr*i2*tau-2*Pr*tau^2+2*Pr*tau*w-4*delta*i2*tau+4*delta*tau^2-4*delta*tau*w+4*tau^2*mu[1]-4*tau^2*mu[2]+Cr*i2-Cr*tau+2*i2*tau-2*tau^2+2*tau*w)/(tau^2*(-1+delta)^2)]

(7)


Analysis of the two constraints

beta

beta

(8)

Cs := { seq(beta[i] = subs(i1=0, f[i](i1)), i=1..2) };

{beta[1] = (2*rho0-1)*tau+i2, beta[2] = -tau-i2}

(9)

 

# two constraints problem

Cmin_value := min(rhs~(Cs));  # the "true" constraints
Cmax_value := max(rhs~(Cs)):

Cmin_name  := min(lhs~(Cs));  # the "abstract" constraints
Cmax_name  := max(lhs~(Cs)):

Cmin_name  := LowerBound;  # and an even more abstract form
Cmax_name  := UpperBound:

Complementary_Slackness := mu[1]*(Cmin_name-i1) , mu[2]*(i1-Cmax_name);

L2     := -`&pi;_m`(i1) + add(Complementary_Slackness):
dL2di1 := diff(L2, i1):
dL2di1 := map(simplify, %, size);
 

min(-tau-i2, (2*rho0-1)*tau+i2)

 

min(beta[1], beta[2])

 

LowerBound

 

mu[1]*(LowerBound-i1), mu[2]*(i1-UpperBound)

 

(1/2)*(tau+i1-i2)*(-1+delta+Pn-Pr)/(tau*(-1+delta))+(1/2)*(-w+i1)*(-1+delta+Pn-Pr)/(tau*(-1+delta))+(1/4)*Cr*(tau+i1-i2)*(-1+delta+Pn-Pr)^2/(tau^2*(-1+delta)^2)-mu[1]+mu[2]

(10)

type(dL2di1, linear([i1, seq(mu[i], i=1..2)]));

SC_CS_sols := solve(
  {
    dL2di1 = 0,
    op([Complementary_Slackness] =~ 0)
  }
  ,
  {i1, seq(mu[i], i=1..2)}
):

true

 

Main: Entering solver with 3 equations in 3 variables
Main: attempting to solve as a linear system
Main: attempting to solve as a polynomial system
Main: Polynomial solver successful. Exiting solver returning 1 solution

 

# How many solutions did we get?

numelems([SC_CS_sols]);

# And those solutions are charecterized by

map(s -> if eval(lambda[1], s) = 0 then
           if eval(lambda[2], s) = 0 then
             "i1 belongs to interval (LowerBound, UpperBound)"
           else
             "i1 is equal to the UpperBound"
           end if
         else
           "i1 is equal to the LowerBound"
         end if
         , [SC_CS_sols]);

# So we get as expected the three possible situations.

3

 

["i1 is equal to the LowerBound", "i1 is equal to the LowerBound", "i1 is equal to the LowerBound"]

(11)

Cmin_value

min(-tau-i2, (2*rho0-1)*tau+i2)

(12)
 

 

Download I_1_Optimum_condition.mw

Easy way to solve 3 equation simultaneously?:

restart

with(Optimization); with(plots); with(LinearAlgebra)

 

K2 := -(Pn-Pr)/(1-delta)+(-beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))+Pr)/delta+(Pr-w-Cr)*beta*(-2+2*delta)*tau*upsilon/(((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))*delta) = 0

 

(1)

K3 := 1-(Pn-Pr)/(1-delta)-(Pn-Cn)/(1-delta)+(Pr-w-Cr)*(1/(1-delta)-(-beta*(Cr*i2-Cr*tau)*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))+beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon*Cr/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))^2)/delta)+Ce*rho0/(1-delta) = 0

 

(2)

K4 := (Pn-Cn)/(1-delta)+(Pn-Pr)/(1-delta)-(-beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))+Pr)/delta+(Pr-w-Cr)*(-1/(1-delta)-(-beta*(-Cr*i2+Cr*tau)*upsilon/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))-beta*((-2*delta+2)*tau^2+((-Pn+Pr-delta+1)*Cr+(-2+2*delta)*(w+i2))*tau+Cr*i2*(-1+delta+Pn-Pr))*upsilon*Cr/((4*delta-4)*tau+Cr*(-1+delta+Pn-Pr))^2+1)/delta)-Ce*rho0/(1-delta) = 0

 

(3)

sol := solve({K2, K3, K4}, {Pn, Pr, w})

Download Q_solve.mw

While solving for i1 encounter too many terms. How can I simplify it so that only " Pn,Pr and w" remain, with all other variables grouped into constants, so that the equation for the optimal i1​ becomes small and manageable?

restart

kernelopts(version)

`Maple 2019.1, X86 64 WINDOWS, May 21 2019, Build ID 1399874`

(1)

Pi1 := (w-i1)*(1/2+(i1-i2)/(2*tau))*(1-(Pn-Pr)/(1-delta))+(s-i1-Crr)*(1/2+(i1-i2)/(2*tau))*((Pn-Pr)/(1-delta)-(-beta*i1*upsilon+Pr)/delta)+Ce*rho0*(((Pn-Pr)/(1-delta)-(-beta*i1*upsilon+Pr)/delta)*eta+1-(Pn-Pr)/(1-delta))

(w-i1)*(1/2+(1/2)*(i1-i2)/tau)*(1-(Pn-Pr)/(1-delta))+(s-i1-Crr)*(1/2+(1/2)*(i1-i2)/tau)*((Pn-Pr)/(1-delta)-(-beta*i1*upsilon+Pr)/delta)+Ce*rho0*(((Pn-Pr)/(1-delta)-(-beta*i1*upsilon+Pr)/delta)*eta+1-(Pn-Pr)/(1-delta))

(2)

diff(Pi1, i1) = 0

-(1/2+(1/2)*(i1-i2)/tau)*(1-(Pn-Pr)/(1-delta))+(1/2)*(w-i1)*(1-(Pn-Pr)/(1-delta))/tau-(1/2+(1/2)*(i1-i2)/tau)*((Pn-Pr)/(1-delta)-(-beta*i1*upsilon+Pr)/delta)+(1/2)*(s-i1-Crr)*((Pn-Pr)/(1-delta)-(-beta*i1*upsilon+Pr)/delta)/tau+(s-i1-Crr)*(1/2+(1/2)*(i1-i2)/tau)*beta*upsilon/delta+Ce*rho0*beta*upsilon*eta/delta = 0

(3)

solve(%, i1)

-(1/3)*(Crr*beta*delta*upsilon-beta*delta*i2*upsilon-beta*delta*s*upsilon+beta*delta*tau*upsilon-Crr*beta*upsilon+beta*i2*upsilon+beta*s*upsilon-beta*tau*upsilon-delta*Pr+delta^2-(6*Ce*beta^2*delta^2*eta*rho0*tau*upsilon^2-12*Ce*beta^2*delta*eta*rho0*tau*upsilon^2+6*Ce*beta^2*eta*rho0*tau*upsilon^2+Crr^2*beta^2*delta^2*upsilon^2+Crr*beta^2*delta^2*i2*upsilon^2-2*Crr*beta^2*delta^2*s*upsilon^2-Crr*beta^2*delta^2*tau*upsilon^2+beta^2*delta^2*i2^2*upsilon^2-beta^2*delta^2*i2*s*upsilon^2-2*beta^2*delta^2*i2*tau*upsilon^2+beta^2*delta^2*s^2*upsilon^2+beta^2*delta^2*s*tau*upsilon^2+beta^2*delta^2*tau^2*upsilon^2-2*Crr^2*beta^2*delta*upsilon^2-2*Crr*beta^2*delta*i2*upsilon^2+4*Crr*beta^2*delta*s*upsilon^2+2*Crr*beta^2*delta*tau*upsilon^2-2*beta^2*delta*i2^2*upsilon^2+2*beta^2*delta*i2*s*upsilon^2+4*beta^2*delta*i2*tau*upsilon^2-2*beta^2*delta*s^2*upsilon^2-2*beta^2*delta*s*tau*upsilon^2-2*beta^2*delta*tau^2*upsilon^2+Crr^2*beta^2*upsilon^2+3*Crr*Pn*beta*delta^2*upsilon-2*Crr*Pr*beta*delta^2*upsilon+Crr*beta^2*i2*upsilon^2-2*Crr*beta^2*s*upsilon^2-Crr*beta^2*tau*upsilon^2+2*Crr*beta*delta^3*upsilon-3*Pn*beta*delta^2*s*upsilon+3*Pn*beta*delta^2*upsilon*w-Pr*beta*delta^2*i2*upsilon+2*Pr*beta*delta^2*s*upsilon+Pr*beta*delta^2*tau*upsilon-3*Pr*beta*delta^2*upsilon*w+beta^2*i2^2*upsilon^2-beta^2*i2*s*upsilon^2-2*beta^2*i2*tau*upsilon^2+beta^2*s^2*upsilon^2+beta^2*s*tau*upsilon^2+beta^2*tau^2*upsilon^2+beta*delta^3*i2*upsilon-2*beta*delta^3*s*upsilon-beta*delta^3*tau*upsilon+3*beta*delta^3*upsilon*w-3*Crr*Pn*beta*delta*upsilon+Crr*Pr*beta*delta*upsilon-4*Crr*beta*delta^2*upsilon+3*Pn*beta*delta*s*upsilon-3*Pn*beta*delta*upsilon*w+2*Pr*beta*delta*i2*upsilon-Pr*beta*delta*s*upsilon-2*Pr*beta*delta*tau*upsilon+3*Pr*beta*delta*upsilon*w-2*beta*delta^2*i2*upsilon+4*beta*delta^2*s*upsilon+2*beta*delta^2*tau*upsilon-6*beta*delta^2*upsilon*w+Crr*Pr*beta*upsilon+2*Crr*beta*delta*upsilon+Pr^2*delta^2-Pr*beta*i2*upsilon-Pr*beta*s*upsilon+Pr*beta*tau*upsilon-2*Pr*delta^3+beta*delta*i2*upsilon-2*beta*delta*s*upsilon-beta*delta*tau*upsilon+3*beta*delta*upsilon*w+delta^4-2*Pr^2*delta+4*Pr*delta^2-2*delta^3+Pr^2-2*Pr*delta+delta^2)^(1/2)+Pr-delta)/(beta*upsilon*(-1+delta)), -(1/3)*(Crr*beta*delta*upsilon-beta*delta*i2*upsilon-beta*delta*s*upsilon+beta*delta*tau*upsilon-Crr*beta*upsilon+beta*i2*upsilon+beta*s*upsilon-beta*tau*upsilon-delta*Pr+delta^2+(6*Ce*beta^2*delta^2*eta*rho0*tau*upsilon^2-12*Ce*beta^2*delta*eta*rho0*tau*upsilon^2+6*Ce*beta^2*eta*rho0*tau*upsilon^2+Crr^2*beta^2*delta^2*upsilon^2+Crr*beta^2*delta^2*i2*upsilon^2-2*Crr*beta^2*delta^2*s*upsilon^2-Crr*beta^2*delta^2*tau*upsilon^2+beta^2*delta^2*i2^2*upsilon^2-beta^2*delta^2*i2*s*upsilon^2-2*beta^2*delta^2*i2*tau*upsilon^2+beta^2*delta^2*s^2*upsilon^2+beta^2*delta^2*s*tau*upsilon^2+beta^2*delta^2*tau^2*upsilon^2-2*Crr^2*beta^2*delta*upsilon^2-2*Crr*beta^2*delta*i2*upsilon^2+4*Crr*beta^2*delta*s*upsilon^2+2*Crr*beta^2*delta*tau*upsilon^2-2*beta^2*delta*i2^2*upsilon^2+2*beta^2*delta*i2*s*upsilon^2+4*beta^2*delta*i2*tau*upsilon^2-2*beta^2*delta*s^2*upsilon^2-2*beta^2*delta*s*tau*upsilon^2-2*beta^2*delta*tau^2*upsilon^2+Crr^2*beta^2*upsilon^2+3*Crr*Pn*beta*delta^2*upsilon-2*Crr*Pr*beta*delta^2*upsilon+Crr*beta^2*i2*upsilon^2-2*Crr*beta^2*s*upsilon^2-Crr*beta^2*tau*upsilon^2+2*Crr*beta*delta^3*upsilon-3*Pn*beta*delta^2*s*upsilon+3*Pn*beta*delta^2*upsilon*w-Pr*beta*delta^2*i2*upsilon+2*Pr*beta*delta^2*s*upsilon+Pr*beta*delta^2*tau*upsilon-3*Pr*beta*delta^2*upsilon*w+beta^2*i2^2*upsilon^2-beta^2*i2*s*upsilon^2-2*beta^2*i2*tau*upsilon^2+beta^2*s^2*upsilon^2+beta^2*s*tau*upsilon^2+beta^2*tau^2*upsilon^2+beta*delta^3*i2*upsilon-2*beta*delta^3*s*upsilon-beta*delta^3*tau*upsilon+3*beta*delta^3*upsilon*w-3*Crr*Pn*beta*delta*upsilon+Crr*Pr*beta*delta*upsilon-4*Crr*beta*delta^2*upsilon+3*Pn*beta*delta*s*upsilon-3*Pn*beta*delta*upsilon*w+2*Pr*beta*delta*i2*upsilon-Pr*beta*delta*s*upsilon-2*Pr*beta*delta*tau*upsilon+3*Pr*beta*delta*upsilon*w-2*beta*delta^2*i2*upsilon+4*beta*delta^2*s*upsilon+2*beta*delta^2*tau*upsilon-6*beta*delta^2*upsilon*w+Crr*Pr*beta*upsilon+2*Crr*beta*delta*upsilon+Pr^2*delta^2-Pr*beta*i2*upsilon-Pr*beta*s*upsilon+Pr*beta*tau*upsilon-2*Pr*delta^3+beta*delta*i2*upsilon-2*beta*delta*s*upsilon-beta*delta*tau*upsilon+3*beta*delta*upsilon*w+delta^4-2*Pr^2*delta+4*Pr*delta^2-2*delta^3+Pr^2-2*Pr*delta+delta^2)^(1/2)+Pr-delta)/(beta*upsilon*(-1+delta))

(4)

simplify(%)

Error, (in simplify/do) invalid simplification command

 
 

``

Download Q_Simplify.mw

I need to isolate i1​ and move the remaining terms to the other side. However, I’m encountering an error while doing this.

Note: All parameters are non-negative (positive or equal to zero).

Attaching sheet: Question_Isolate_i1.mw

I’m getting an error while solving the equations derived from the KKT conditions.
What syntax modifications should I make?
The decision variables are p1 and pr, with two constraints.

sheet: Q1_solve_equation.mw
 

In the 3D figure, the z-axis currently extends only to zero; please extend it to include positive values. Also help needed in setting the optimal point which is not clearly visible now—how to adjust the view and labeling to highlight only its z-value. How can we Improve the overall clarity and positioning of the figure to enhance visual readability.

Q_figure.mw

Download Q_figure.mw

Getting an error while solving. Can we get a condition like  delta ( > or <)  delta3 × constant?
Note: All parameters are positive and greater than zero.          tau, tau1, delta, delta3, delta0 are between 0 and 1. 

restart

``

ineq := (1-delta-tau1)*d*Cv+w*delta*d+Rm*tau1*d+s2*d*(delta0-delta-tau1)+g1*tau1^2*d^2+g2*delta^2*d^2 <= R0m*tau1^2*d^2+(1-delta[3]-tau1)*d*Cv+w*delta[3]*d+s2*d*(delta0-delta[3]-tau1)+g2*(delta[3]+tau1)^2*d^2

(1-delta-tau1)*d*Cv+w*delta*d+Rm*tau1*d+s2*d*(delta0-delta-tau1)+g1*tau1^2*d^2+g2*delta^2*d^2 <= R0m*tau1^2*d^2+(1-delta[3]-tau1)*d*Cv+w*delta[3]*d+s2*d*(delta0-delta[3]-tau1)+g2*(delta[3]+tau1)^2*d^2

(1)

NULL

``

temp := collect(ineq,delta);

g2*delta^2*d^2+(-Cv*d-d*s2+d*w)*delta+(1-tau1)*d*Cv+Rm*tau1*d+s2*d*(delta0-tau1)+g1*tau1^2*d^2 <= R0m*tau1^2*d^2+(1-delta[3]-tau1)*d*Cv+w*delta[3]*d+s2*d*(delta0-delta[3]-tau1)+g2*(delta[3]+tau1)^2*d^2

(2)

new := simplify(temp - remove(depends,lhs(temp),delta) - select(depends,rhs(temp),delta));

-d*(d*g2*delta[3]^2+(2*d*g2*tau1-Cv-s2+w)*delta[3]+(-delta^2*g2+g2*tau1^2)*d+(-w+Cv+s2)*delta+(-Cv-s2)*tau1+s2*delta0+Cv) <= -d*(d*(g1-R0m)*tau1^2+(-Cv+Rm-s2)*tau1+s2*delta0+Cv)

(3)

simplify(solve(new,delta));

Warning, solutions may have been lost

 

Error, invalid input: simplify uses a 1st argument, s, which is missing

 
 

NULL

Download Q_on_solve.mw

Could anyone help me with the syntax to create a Region Plot (Feasibility or Preference Map) that displays: Regions based on conditions like:

  • When   and  πR>πD ​ ​, then Strategy 1 is preferred.
    and  When ​, πR<πD then Strategy 2 is better.
     
  • When ​,πR<πD then Strategy 2 is preferred.
    and When ​,πR>πD then Strategy 1 is better.

I’d also like the plot to visually highlight the regions based on strategy​, and vice versa.

File : Regional_plot.mw

I am working with two plots and need help in labeling,

Plot 1: I would like to display the intersection point of the two curves along with the corresponding value of δ (delta) at that point. Ideally, this can be highlighted using an arrow or annotation.

Plot 2: I would like to identify and mark the maximum point of the two curves. Specifically, I want to show the maximum value and the corresponding value of w at which this occurs.

Could anyone help with the syntax. Is there any method to improve the quality of figure to export it as jpeg?

Q_NEW_PLOT.mw

I have a contour plot, and I need to make the following modifications. Could anyone please guide me on how to change the syntax accordingly?
 

  1. Remove grid lines (black lines) from my plot.

  2. Swap the axes so that s2  appears on the Y-axis, ranging from 1000 to 7000. Currently, s2 is shown on the X-axis from 1 to 7.

  3. Add a color scale (legend) for the contour values of stemp (with label), with formatted values like 1.47 × 10⁷ (scientific notation).

    Attaching my file with plot: S1_vs_s2_contour_plot.mw

I’ve attached (or described) a sample contour plot for reference.

I am trying to display the results by substituting values into a table format after solving the KKT conditions. I attempted to do this using Maplet, but it did not give the desired output or flexibility.

Could you please guide me on:

  • The correct way to capture and display substituted results in a table?

  • Any alternative syntax or functions (other than Maplet) that are better suited for this purpose?

I would also like to confirm whether the substitution I made for the lower and upper bounds—specifically C_min value  and C_max value —has been done correctly. Could you please verify if this is the correct way to implement these bounds within the KKT formulation?

KKT_Table_Q-22.mw

When optimizing with constraints, I’m getting an error: ‘NLP no feasible point’.

However, when I plot the graph, it shows a result — there appears to be a point where p1 is positive and s is maximized.

Could you help identify if there’s a syntax issue? Also, what’s the correct syntax to visualize the constraints in the plot?

Sheet: 07.mw

I need to export an image in high resolution in JPEG, JPG, and PDF formats. Right now, I'm using screenshots, which results in low clarity. Could you please help me with the correct syntax to generate a high-resolution, downloadable image in these formats? I'm attaching the file below:

q_new.mw

The two profit functions intersect at a certain point, but the graph is not clearly visible in the range of Cb​ from 30,000 to around 60,000. How can I adjust the plot to make this range more visible? What can i do such that two lines are seen distinct in that area?

Sheet:Q_12.mw

I'm working on an optimization problem involving a single decision variable p1, subject to four inequality constraints:

  • Two upper bound constraints:

    p1 < b1,p1 < b2
  • Two lower bound constraints:

    c1 ≤ p1,c2 ≤ p1

Effectively, the feasible region for p1 is:

max⁡(c1,c2)  ≤  p1  ≤  min⁡(b1,b2)

I have already formulated the Karush-Kuhn-Tucker (KKT) conditions for this setup, and now I'm trying to determine:

  1. The optimal value p1∗​

  2. The corresponding feasibility conditions

  3. A case-wise breakdown depending on which constraints are active or inactive


Sheet:  Q_P1_Optimum_condition.mw

1 2 3 4 5 6 7 Last Page 1 of 47